#!/bin/bash
#crontab 2 2 * * * source $HOME/.bash_profile && /sumz/script/etcd_bak.sh
current_time=$(date +"%Y-%m-%d_%H-%M-%S")
/usr/local/bin/etcdctl --endpoints 127.0.0.1:2379 --cacert /etc/ssl/etcd/ssl/ca.pem --cert /etc/ssl/etcd/ssl/member-master1.pem --key /etc/ssl/etcd/ssl/member-master1-key.pem snapshot save /sumz/etcd_bak_data/snapshot.db
zip /sumz/etcd_bak_data/snapshot.db.$current_time.zip /sumz/etcd_bak_data/snapshot.db && rm -f /sumz/etcd_bak_data/snapshot.db
find /sumz/etcd_bak_data/ -type f -mtime +30 -exec rm {} \;
 
